<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Sayreville EMS</title>
<link href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>

<link href="css/style1.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />

<script src="js/modernizr.geoloc.js"></script>

<style type="text/css">
<!--
.style10 {color: #0000FF}
-->
</style>
  
</head>

<body>

<div data-role="page" id="route">
	<div class="pagebody">
	
	<?php include 'headerbar.php'?>
		
		<div data-role="body">
		
			<div class="heading">&nbsp;&nbsp;<br />Route</div>
			
			<?php include 'navbar2.php'?>
			
			<br/>
			
			<p>
			<strong>Note:</strong> After you click submit, please allow access to your geographic location if asked.
			</p>
			
			<form data-ajax="false" action="" method="post" style="padding:5px;">
				<div data-role="fieldcontain">
				<div id="geo"></div>
				<b>To:</b> 
<?php
session_start();
echo $_REQUEST['comp_name'];
$address = $_REQUEST['address'];
$comp_name = $_REQUEST['comp_name'];
$_SESSION['address'] = $address;
$_SESSION['comp_name'] = $comp_name;
$lat = $_REQUEST['lat'];
$lng = $_REQUEST['lng'];
$_SESSION['lat'] = $lat;
$_SESSION['lng'] = $lng;
?><br/>
				
					<fieldset data-role="controlgroup">
						<legend>Show Route As:</legend>
							<input type="radio" name="route_type" id="radio-choice-1" value="map" checked="checked" />
							<label for="radio-choice-1">Map</label>

							<input type="radio" name="route_type" id="radio-choice-2" value="text"  />
							<label for="radio-choice-2">Text</label>
					</fieldset>
					<input type="submit" name="submit" value="Submit" />
				</div>
			</form>
			
		<script type="text/javascript">
			var geo = document.getElementById("geo");
			if (Modernizr.geolocation) {
				var l = "<div><b>From:</b> <input type='text' name='start' placeholder='Current Location' /><br/></div>";
			} else {
				var l = "<div><b>From:</b> <input type='text' name='start' /><br/></div>";
			}
			var oDiv = document.createElement('div');
			oDiv.innerHTML = l;
			geo.appendChild(oDiv);
		</script>
			
		</div>
		
<?php
if (isset($_POST['submit'])) {
	$type = $_POST['route_type'];
	$start = $_POST['start'];
	if ($type == 'map') {
		header("location: map2.php?start=$start");
	}
	if ($type == 'text') {
		header("location: text.php?start=$start");
	}
}
?>

		<?php include 'footer.php'?>
	</div>  
</div>

</body>
</html>